package org.skyeye.modeling.parts;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;

import org.skyeye.modeling.model.MConnection;
import org.skyeye.modeling.model.MDevice;
import org.skyeye.modeling.model.MLinker;
import org.skyeye.modeling.model.MSOC;
import org.skyeye.modeling.model.MRoot;

/**
 * manage our new EditParts
 * 
 * @author Administrator
 * 
 */
public class PartFactory implements EditPartFactory {

	public EditPart createEditPart(EditPart context, Object model) {
		EditPart part = null;
		if (model instanceof MRoot)
			part = new RootPart();
		else if (model instanceof MConnection)
			part = new ConnectionPart();
		else if (model instanceof MSOC)
			part = new SOCPart();
		else if (model instanceof MLinker)
			part = new MLinkerPart();
		else
			part = new DevicePart();
		part.setModel(model);
		return part;
	}
}